home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Corrida / dragracer.swf / scripts / DefineButton2_564 / BUTTONCONDACTION on(release).as
Encoding:
Text File  |  2005-10-06  |  1.4 KB  |  46 lines

  1. on(release){
  2.    if(_root.player.cash - cost >= 0 && (upgrade_type != "PUPGRADE" || upgrade_type == "PUPGRADE" && !_root.car["UPGRADE" add scrollnum]))
  3.    {
  4.       _root.player.cash -= cost;
  5.       if(upgrade_type != "PUPGRADE")
  6.       {
  7.          property = _root.car[_root[upgrade_type].UPGRADESET1[scrollnum]];
  8.          property += _root[upgrade_type].UPGRADESET[scrollnum];
  9.       }
  10.       else
  11.       {
  12.          _root.car.HP += _root[upgrade_type].UPGRADESET[scrollnum];
  13.          _root.car.TQ += _root[upgrade_type].UPGRADESET[scrollnum];
  14.          _root.car.WT += 100;
  15.          _root.car["UPGRADE" add scrollnum] = true;
  16.          if(_root.car.HP > 999)
  17.          {
  18.             _root.car.HP = 999;
  19.          }
  20.          if(_root.car.TQ > 700)
  21.          {
  22.             _root.car.TQ = 700;
  23.          }
  24.       }
  25.       if(property > _root[_root[upgrade_type].UPGRADESET1[scrollnum] + "MAX"])
  26.       {
  27.          property = _root[_root[upgrade_type].UPGRADESET1[scrollnum] + "MAX"];
  28.          _root.player.cash += cost;
  29.       }
  30.       else if(upgrade_type == "WEIGHT" && property < 1000)
  31.       {
  32.          _root.player.cash += cost;
  33.          property = 1000;
  34.       }
  35.       if(upgrade_type != "PUPGRADE")
  36.       {
  37.          _root.car[_root[upgrade_type].UPGRADESET1[scrollnum]] = Math.round(property * 10) / 10;
  38.       }
  39.       Update();
  40.    }
  41.    else
  42.    {
  43.       _root.prompt(" ","Not Enough Cash!",3);
  44.    }
  45. }
  46.